package com.oplink.webems.modules.alarm.entity;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.oplink.webems.modules.cfg.entity.CfgCardType;

/**
 * Alarm Properties Entity
 * @author yizhang
 */
@Entity
@Table(name = "alarm_prop")
@DynamicInsert @DynamicUpdate
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class AlarmProp {

	//ID
	private Long id;
	
	//严重程度
	private AlarmSeverity severity;
	
	//告警量
	private AlarmType alarmtype;
	
	//描述
	private String description;

	//是否过滤
	private int filter;
	
	//告警名称
	private String aname;
	
	private CfgCardType cardtype;
	
	private String sid;
	
	private String nid;
	
	public AlarmProp(){
		super();
	}
	
	public AlarmProp(Long id){
		this();
		this.id = id;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)	
	public Long getId() {
		return id;
	}

	public void setId(Long id) { 
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name="severity")
	@NotFound(action = NotFoundAction.IGNORE)	
	@JsonIgnore
	public AlarmSeverity getSeverity() {
		return severity;
	}

	public void setSeverity(AlarmSeverity severity) {
		this.severity = severity;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name="alarmtype")
	@NotFound(action = NotFoundAction.IGNORE)
	@JsonIgnore
	public AlarmType getAlarmtype() {
		return alarmtype;
	}

	public void setAlarmtype(AlarmType alarmtype) {
		this.alarmtype = alarmtype;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public int getFilter() {
		return filter;
	}

	public void setFilter(int filter) {
		this.filter = filter;
	}

	public String getAname() {
		return aname;
	}

	public void setAname(String aname) {
		this.aname = aname;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name="cardtype")
	@NotFound(action = NotFoundAction.IGNORE)
	@JsonIgnore	
	public CfgCardType getCardtype() {
		return cardtype;
	}

	public void setCardtype(CfgCardType cardtype) {
		this.cardtype = cardtype;
	}

	@Transient
	public String getSid() {
		return sid;
	}

	public void setSid(String sid) {
		this.sid = sid;
	}

	@Transient
	public String getNid() {
		return nid;
	}

	public void setNid(String nid) {
		this.nid = nid;
	}
	
	
	
}
